<template>
	<view class="being">
		<view class="content">

			<view class="top" :style="{'padding-top': paddingTop}">
				<uni-icons @click="toBackPage" style="margin-left: 30rpx;width: 50rpx;" type="left" size="25"
					color="#2c2c2c">
				</uni-icons>
				<view style="display: flex;flex-direction: row;text-align:center;width: 150rpx;margin-left: 220rpx;">
					暗流空间</view>
			</view>

			<view class="search">
				<uni-icons type="search" size="25" color="#2c2c2c"></uni-icons>
				<input @blur="pageCourse" style="width:570rpx" placeholder="请输入名称或描述关键词" v-model="queryInput.name" />
			</view>
			
			<view class="wind-spaces" v-if="questionSpacesList && questionSpacesList.length>0">
				<view v-for="(item,index) in questionSpacesList" @click="gotoSpaceManage(item.id)"
					class="wind-space">
					<view class="cover">
						<view
							style="font-size: 38rpx;color: #6AB9C0;margin-bottom: 30rpx;font-weight: bold;">
							{{item.title}}
						</view>
						<view class="context" v-html="item.context"></view>
					</view>
					<view class="counts">
						<view class="item">
							<view class="item-top">
								{{item.followerCount}}
							</view>
							<view class="item-bottom">
								关注数
							</view>
						</view>
						<view class="item">
							<view class="item-top">
								{{item.pointCount}}
							</view>
							<view class="item-bottom">
								观点数
							</view>
						</view>
						<view class="item">
							<view class="item-top">
								{{item.answerCount}}
							</view>
							<view class="item-bottom">
								回答数
							</view>
						</view>
					</view>
					<view class="points">
						<view v-for="point in item.points" class="point" >
							<view class="point-text">{{point.keyword}}</view>
							<view class="point-avatar">
								<image mode="aspectFill" :src="point.avatar"></image>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="wind-spaces-empty" v-else>
				<view class="text">暂时没有哦，去探索其他区域吧</view>
			</view>

		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				queryInput: {
					pageNow: 1,
					pageSize: 20,
					total: 0,
					name: ""
				},
				questionSpacesList: [],
				paddingTop: null
			}
		},
		onLoad() {
			this.listQuestionSpace();
			
			// 调整搜索位置
			// #ifdef MP-WEIXIN
			// 1.获取屏幕可使用宽度
			let windowWidth = uni.getSystemInfoSync().windowWidth;
			// 3.获取胶囊按钮位置信息
			const menuButton = uni.getMenuButtonBoundingClientRect();
			// // 5.导航栏与状态栏拉开距离  margin-top: statusBarTop + 'rpx';
			this.paddingTop = menuButton.top * (750 / windowWidth) + 'rpx';
			// #endif
		},
		methods: {
			listQuestionSpace() {
				this.$api.listQuestionSpace().then(res => {
					this.questionSpacesList = res.data
				})
			},
			gotoSpaceManage(id) {
				uni.navigateTo({
					url: '/pages_self/wind/manage/question/question-manage?questionId=' + id
				});
			},
			toBackPage(){
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.being {
		background-color: #FAFAFA;
		min-height: 100vh;

		.content {
			display: flex;
			flex-direction: column;

			.top {
				width: 100%;
				height: 50rpx;
				//#ifdef MP-WEIXIN
				width: 550rpx;
				//#endif

				padding-top: 100rpx;

				// #ifdef H5
				padding-top: 40rpx;
				// #endif

				padding-bottom: 20rpx;

				display: flex;
				flex-direction: row;
				align-items: center;
				box-shadow: 1px 1px 8px 2px #f0f0f0;
			}


			.search {
				height: 80rpx;
				width: 640rpx;
				margin: 30rpx 0 30rpx 30rpx;
				background-color: #FFFFFF;
				box-shadow: 1px 1px 8px 2px #f0f0f0;
				border-radius: 20rpx;

				padding: 0 20rpx;

				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;


			}

			.title {
				font-size: 36rpx;
				font-weight: bold;
				margin: 30rpx 0 30rpx 30rpx;
				position: relative;
				width: 690rpx;
				display: flex;
				flex-direction: row;
				justify-content: space-between;

				.mark {
					width: 45rpx;
					height: 35rpx;
					background-color: #B3DFDE;
					border-radius: 40%;
					position: absolute;

					top: 5rpx;
					left: 0;
					z-index: 1;
				}

				.text {
					padding-left: 15rpx;
					position: relative;
					z-index: 2;
					letter-spacing: 4rpx;
				}

				.right {
					display: flex;
					flex-direction: row;
					align-items: center;
					font-size: 28rpx;
					margin-bottom: 5rpx;
					font-weight: normal;
				}

			}
			
			.wind-spaces-empty{
				width: 670rpx;
				margin: 20rpx 0;
				margin-left: 40rpx;
				height: 250rpx;
				border-radius: 20rpx;
				
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				
				.text{
					letter-spacing: 5rpx;
				}
				
				
			}

			.wind-spaces {
			
				display: flex;
				flex-direction: column;
				width: 670rpx;
				margin-left: 40rpx;
				
				.wind-space{
					display: flex;
					flex-direction: column;
					margin-bottom: 30rpx;
					line-height: 50rpx;
					
					.cover {
						width: 630rpx;
						padding: 40rpx 30rpx 40rpx;
					
						border-radius: 20rpx;
						overflow: hidden;
						background-color: #FFFFFF;
					
						color: #2c2c2c;
					
						.context {
							// /deep/p {
							// 	margin: 20rpx 0;
							// }
							
							/deep/img {
								width: 100%;
							}
						}
					}
					
					.counts {
						font-size: 28rpx;
						width: 690rpx;
						border-radius: 20rpx;
						margin-top: 20rpx;
						background-color: #FFFFFF;
						display: flex;
						flex-direction: row;
						justify-content: space-around;
						align-items: center;
					
						.item {
							display: flex;
							flex-direction: column;
							justify-content: space-between;
							align-items: center;
							width: 150rpx;
							padding: 20rpx 0;
					
							.item-top {
								font-size: 32rpx;
								color: #6AB9C0;
							}
					
							.item-bottom {
								font-size: 28rpx;
								color: #6AB9C0;
							}
						}
					}
					
					
					.points {
						display: flex;
						flex-direction: column;
						justify-content: space-between;
						align-items: center;
						margin-top: 20rpx;
					
					
						.point {
							width: 630rpx;
							padding: 20rpx 30rpx;
							display: flex;
							flex-direction: row;
							justify-content: space-between;
							align-items: center;
							background-color: #FFFFFF;
							border-radius: 20rpx;
							margin-bottom: 20rpx;
					
							.point-text {
								width: 550rpx;
							}
					
							.point-avatar {
								height: 50rpx;
								width: 50rpx;
					
								image {
									width: 100%;
									height: 100%;
									border-radius: 50rpx;
								}
							}
						}
					}
					
				}
			
			
				
			}
		}

	}


	image {
		width: 100%;
		height: 100%;
	}

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
</style>
